package com.qingcloud.fexecutor.base.enums;

public enum WebAppCategoryEnum {

    PROJECT(1, "项目管理"),
    ENV(2, "智慧环保"),
    AREA(3, "智慧园区"),
    PERSON(4, "人事"),
    IOT(5, "物联网"),
    FIN(6, "财务"),
    YINGXIAO(7, "营销"),
    XIAOSHOU(8, "销售"),
    CAIGOU(9, "采购"),
    QITA(10, "其他");

    public final Integer code;
    public final String name;

    WebAppCategoryEnum(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getNameByCode(Integer code) {
        for (WebAppCategoryEnum type : WebAppCategoryEnum.values()) {
            if (code.equals(type.code)) {
                return type.name;
            }
        }
        return "";
    }

    public static WebAppCategoryEnum findByName(String name) {
        for (WebAppCategoryEnum type : WebAppCategoryEnum.values()) {
            if (type.name().equalsIgnoreCase(name)) {
                return type;
            }
        }
        return null;
    }
}
